using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class MainForm : MonoBehaviour
{
    public Image healthBar;//血条
    public TMP_Text healthText;//血量文字

    private void Update() {
        OnOnplayerHealthChanged(PlayerStats.instance.startHealth, PlayerStats.instance.health);
    }

    private void OnOnplayerHealthChanged(float health, float startHealth)
    {
        healthBar.fillAmount = startHealth / health;
        healthText.SetText($"{health}/{startHealth}");
    }
}
